package org.example.java8.collector;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collector;

public class CustomerCollectorAction {
    public static void main(String[] args) {
        Collector<String, List<String>, List<String>> collector = new ToListCollector<>();
        //String[] arrs = new String[]{"Alex", "wang", "hello", "world", "lambda", "stream"};
        //List<String> result = Arrays.stream(arrs)
        //        .filter(s -> s.length() >= 5)
        //        .collect(collector);

        List<String> list = Arrays.asList("Alex", "wang", "hello", "world", "lambda", "stream");
        List<String> result = list.parallelStream().filter(s -> s.length() >= 5)
                .collect(collector);

        System.out.println(result);
    }
}

